<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "stock");
%>
<%@ include file="/WEB-INF/views/shared/master/contentHeader.jsp"%>
<style >
.panel{margin-bottom:0px;}	
	.thumbnail{margin: 0px}
	#logo{margin: 0px;padding: 0px;}
	.pic{padding: 0px;height:60px;width:60px;}
	#area{
		height:380px;
		width:1097px;
		overflow-y:auto; 
	}
	.form-detailed .form-group{
		margin-bottom: 0px !important;
	}
</style>
<ul class="nav nav-tabs nav-tabs-component " style="margin-bottom: 0px;">
	<li class="active"><a href="#category-tab" data-toggle="tab" >原单详情</a></li>
	<li><a href="#payment-tab" data-toggle="tab" >修改单详情</a></li>
</ul>
<div class="tab-content">
	<div class="tab-pane active" id="category-tab">
		<t:panel cssClass="panel-flat form-detailed" customBody="true" customHead="true">
			<div class="detailed-navbar-content panel-body">
				<t:form modelAttribute="outStockYuan" action="/stock/outStock/affirmModifySave" method="post" cssClass="form-horizontal">
					<div class="hide">
						 <t:hidden path="outStockId"/>
		 				 <t:hidden path="deleteMark"/>	
		 				 <t:hidden path="createUserName"/>
				 		 <t:hidden path="createUserId"/>
				 		 <t:hidden path="createDate"/>
				 		 <t:hidden path="shopId"/>
					</div>
					<t:formgroup>
						<label for="billingNo" class="col-sm-1 col-xs-1 control-label cursor-pointer text-right">关联单号</label>
		                <t:input readonly="true" path="billingNo" colClass="col-sm-2 col-xs-2" />
		                <label for="customerName" class="col-sm-1 col-xs-1 control-label cursor-pointer text-right">客户名称</label>
		                <t:input readonly="true" path="customerName" colClass="col-sm-2 col-xs-2" />
		                <label for="outStockNum" class="col-sm-1 col-xs-1 control-label cursor-pointer text-right">出库数</label>
		                <t:input readonly="true" path="outStockNum" colClass="col-sm-2 col-xs-2" />
		                <label for="type" class="col-sm-1 col-xs-1 control-label cursor-pointer text-right">类型</label>
		                <div class="col-sm-2 col-xs-2">
		                	<select readonly="true" id="type" name="type" class="custom-select2 select2-hidden-accessible" data-control-type="select2" data-select2-placeholder="出库类型" data-select2-allowclear="true" tabindex="-1" aria-hidden="true">
		                		<option value=""></option>
		                		<option value="1" selected="selected">发货</option>
		                		<option value="2">批量出库</option>
		                		<option value="3">退欠货</option>
		                		<option value="4">退货</option>
		                	</select>
		                </div>
		            </t:formgroup>
		            <div id="area">
					<table  class="cntable table table-bordered dataTable table-billing">
			            <thead>
			            	<th style="width:185px">序号</th>
			            	<th style="width:250px">商品编码</th>
			            	<th style="width:50px">商品名称</th>
			            	
			            	<th style="width:150px">规格</th>
			            	<th style="width:50px">数量</th>
			            	
			            </thead>
			            
			            <tbody id="outStockInfo">
			            	<c:set var="sequence"  value="0"/>
			            	<c:forEach var="outStockShow" items="${outStockYuan.outStockShows}">
									<c:forEach var="outStockCollocation" items="${outStockShow.outStockCollocations}" >
										
										<tr id="outStockCollocation_${sequence}">
											<td style="display:none"><input id="collocationId_${sequence}" name="collocationId" type="text" value="${outStockCollocation.collocationId}"/></td>
											<td style="display:none"><input id="cargoId_${sequence}" name="cargoId" type="text" value="${outStockShow.cargoId}"/></td>
											<td>${sequence+1}</td>					
							            	<td><input style="ime-mode:disabled" id="cargoNo_${sequence}" name="cargoNo" type="text" value="${outStockShow.cargo.cargoNo}"></input></td>
							            	<td><input style="ime-mode:disabled" disabled="disabled" id="cargoName_${sequence}" name="cargoName" type="text" value="${outStockShow.cargo.cargoName}"/></td>
							            	<td><input style="ime-mode:disabled" disabled="disabled" id="propertyName_${sequence}" name="propertyName" type="text" value="${outStockCollocation.collocation.propertyNameOne}/${outStockCollocation.collocation.propertyNameTwo}"/></td>
											
											<td><input style="ime-mode:disabled" disabled="disabled" onkeyup="return ValidateNumber(this,value)" id="collocationNum_${sequence}"  name="collocationNum" type="text" value="${outStockCollocation.collocationNum}"/></td>
										</tr>
										<c:set var="sequence"  value="${sequence +1}"/>
									</c:forEach>
								</c:forEach>
						</tbody>
		            </table>
		            </div>
				</t:form>
			</div>
		</t:panel>
	</div>
	<div class="tab-pane" id="payment-tab">
		<t:panel cssClass="panel-flat form-detailed" customBody="true" customHead="true">
			<div class="detailed-navbar-content panel-body">
				<t:form id="modify" modelAttribute="outStock" action="/stock/outStock/affirmModifySave" method="post" cssClass="form-horizontal">
					<div class="hide">
						 <t:hidden path="outStockId"/>
		 				 <t:hidden path="deleteMark"/>	
		 				 <t:hidden path="createUserName"/>
				 		 <t:hidden path="createUserId"/>
				 		 <t:hidden path="createDate"/>
				 		 <t:hidden path="shopId"/>
				 		 <input type="hidden" value="" id="endType" name="endType"/> 
					</div>
					<t:formgroup>
		            	<t:label path="billingNo" cssClass="col-sm-1 col-xs-1" />
		                <t:input readonly="true" path="billingNo" colClass="col-sm-2 col-xs-2" />
		                <t:label path="customerName" cssClass="col-sm-1 col-xs-1" />
		                <t:input readonly="true" path="customerName" colClass="col-sm-2 col-xs-2" />
		                <t:label path="outStockNum" cssClass="col-sm-1 col-xs-1" />
		                <t:input readonly="true" path="outStockNum" colClass="col-sm-2 col-xs-2" />
		                <t:label path="type" cssClass="col-sm-1 col-xs-1" />
		                <t:select2 readonly="true" path="type" placeholder="出库类型" allowClear="true" colClass="col-sm-2 col-xs-2"></t:select2>
		            </t:formgroup>
		            <div id="area">
					<table  class="cntable table table-bordered dataTable table-billing">
			            <thead>
			            	<th style="width:185px">序号</th>
			            	<th style="width:250px">商品编码</th>
			            	<th style="width:50px">商品名称</th>
			            	
			            	<th style="width:150px">规格</th>
			            	<th style="width:50px">数量</th>
			            	
			            </thead>
			            
			            <tbody id="outStockInfo">
			            	<c:set var="sequence"  value="0"/>
			            	<c:forEach var="outStockShow" items="${outStock.outStockShows}">
									<c:forEach var="outStockCollocation" items="${outStockShow.outStockCollocations}" >
										
										<tr id="outStockCollocation_${sequence}">
											<td style="display:none"><input id="collocationId_${sequence}" name="collocationId" type="text" value="${outStockCollocation.collocationId}"/></td>
											<td style="display:none"><input id="cargoId_${sequence}" name="cargoId" type="text" value="${outStockShow.cargoId}"/></td>
											<td>${sequence+1}</td>					
							            	<td><input style="ime-mode:disabled" id="cargoNo_${sequence}" name="cargoNo" type="text" value="${outStockShow.cargo.cargoNo}"></input></td>
							            	<td><input style="ime-mode:disabled" disabled="disabled" id="cargoName_${sequence}" name="cargoName" type="text" value="${outStockShow.cargo.cargoName}"/></td>
							            	<td><input style="ime-mode:disabled" disabled="disabled" id="propertyName_${sequence}" name="propertyName" type="text" value="${outStockCollocation.collocation.propertyNameOne}/${outStockCollocation.collocation.propertyNameTwo}"/></td>
											
											<td><input style="ime-mode:disabled" disabled="disabled" onkeyup="return ValidateNumber(this,value)" id="collocationNum_${sequence}"  name="collocationNum" type="text" value="${outStockCollocation.collocationNum}"/></td>
										</tr>
										<c:set var="sequence"  value="${sequence +1}"/>
									</c:forEach>
								</c:forEach>
						</tbody>
		            </table>
		            </div>
				</t:form>
			</div>
		</t:panel>
	</div>
</div>

<div class="panel-footer ">
	<div class="heading-elements">
		<div style="float:right;" class="heading-btn pull-right-important">
			<t:button icon="icon-floppy-disk" onclick="saveData()" laddaType="progress" data-endType="waive" cssClass="btn-info" csize="sm" >放弃修改</t:button>
			<t:button icon="icon-floppy-disk" onclick="saveData()" laddaType="progress" data-endType="affirm" cssClass="btn-info" csize="sm" >确人修改</t:button>
		</div>
	</div>
</div>

<script type="text/javascript">

function saveData(lbtn){
	$("#endType").val(arguments[1].attr("data-endType"));

	if (!$("form:first").valid()){
		return;
	}
	lbtn.start();
	$("#modify").submit();
}
$(function(){
	tabpaneResize();
	iframeLazyOpen();
})
function tabpaneResize(){
	$(".tab-pane").height($(window).height() - 92);
	
	$(window).bind("resize",function(){$(".tab-pane").height($(window).height() - 92)});
	
}

function iframeLazyOpen(){
	$(".nav.nav-tabs.nav-tabs-component li a").click(function(){
		var iframeTab = $(this).attr("href");
		if(iframeTab=="#payment-tab"){
			$("#payment-tab").show();
			$("#category-tab").hide();
		}else{
			$("#payment-tab").hide();
			$("#category-tab").show();
		}
		
	});
}
</script>
<%@ include file="/WEB-INF/views/shared/base/scripts/jqueryui.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formtags.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formbuttons.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formpickers.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formselects.jsp"%>
<%@ include file="/WEB-INF/views/shared/base/scripts/limitless/default/formstyling.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/dialog.jsp"%>
<%@ include file="/WEB-INF/views/shared/master/contentFooter.jsp"%>
